<template>
  <div class="container-y">
    <div class="d-item-wrap">
      <div class="d-title">
        专家研判
      </div>
      <div class="d-content">

        <div class="item" @click="goOrg">
          <div class="label">
            选择专家
          </div>
          <div class="txt txt-chose wordHidden-2">
            {{$store.state.zjChecked.txt}}
          </div>
        </div>

        <div class="item">
          <div class="label">
            <span class="neededFlag"></span>
            研判要求
            <!--<voice-txt-area></voice-txt-area>-->
          </div>
          <div class="txt">
            <textarea class="txt-area"
                      id="zj"
                      placeholder="点击输入文字">
            </textarea>
          </div>
        </div>
      </div>
    </div>
    <!--按钮区域-->
    <div class="btn-wrap">
      <div class="btn-b" @click="confirm">
        确定
      </div>
    </div>
    <transition name="slideRight">
      <router-view></router-view>
    </transition>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        type: "",
      }
    },
    methods: {
      goOrg() {
        let path = {
          20: '/detail/toZJ/zjList',
          30: '/detail/toZJ/zjList',
          40: '/tnDetail/toZJ/zjList',
        }[this.type];
        _methods.goPath(path);
      },
      //继续跟踪提交
      confirm() {
        // 40 今日快报

        let aj = {
          20: _ajaxUrls.applyJudgment,
          30: _ajaxUrls.warnApply,
          40: _ajaxUrls.infoJudgeSend,
        }[this.type];

        // warnId:风险预警id
        // expertIds	:专家id串
        // judgmentClaim:研判要求
        // startTime	:操作时间
        // userId:操作人id

        let id = _methods.getUrlParam("id");

        let pd = [];
        this.$store.state.zjChecked.val.forEach((i) => {
          if (i.userId) {
            pd.push(i.userId);
          }
        });

        let expertIds = pd.join(",");

        let judgmentClaim = _methods.getValue("zj");

        if (!judgmentClaim) {
          mui.toast("请填写研判要求");
          return;
        }

        let data = {};

        if (this.type == 40){
          data = {
            expertIds: expertIds,
            judgmentClaim: judgmentClaim,
            messageId: id,
            userId: _data.userInfo.userId,
            isSelf: 0,
          }

        }else {
          data = {
            expertIds: expertIds,
            judgmentClaim: judgmentClaim,
            startTime: _data.zjTime,
            userId: _data.userInfo.userId,
            businessId: id,
            type:_data.isFxType,
          }
        }

        _ajax.confirmWithLoading(aj.url,
          data,
          () => {
            _alert.alert(() => {
              _data.bus.$emit("refresh", 1);
              _methods.goBack();
            });
          }, aj.type);
      },
    },
    created() {
      this.headerFlag = this.$store.state.headerRightType;
      this.title = this.$store.state.showFlag;
      _methods.headerRightShow();
      _methods.headerTitleChange(115);
      this.type = _methods.getUrlParam("type") - 0;
    },
    beforeDestroy() {
      _methods.headerTitleChange(this.title, true);
      _methods.headerRightShow(this.headerFlag);
    }
  }
</script>
